package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>
 * Title
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright (c) 2007
 * </p>
 * 
 * @author Andrew Carter
 * @version
 */


/**
 * Enumerates the permissible texture filter modes.
 * 
 * @author Andrew Carter
 */
public enum E_TextureFM {

	/**
	 * Filter option to return the value of the texture element that is nearest to the center of the
	 * pixel being textured.
	 */
	FM_NEAREST("FM_NEAREST", 0),

	/**
	 * Filter option to return the weighted average of the four texture elements that are closest to
	 * the center of the pixel being textured.
	 */
	FM_LINEAR("FM_LINEAR", 1);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value String literal of the enum
	 */
	private E_TextureFM(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureFM getConstant(String name) {

		for(E_TextureFM constant : E_TextureFM.values()) {

			if(constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureFM getConstant(int type) {

		for(E_TextureFM constant : E_TextureFM.values()) {

			if(constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * 
	 * @return
	 */
	public int getType() {

		return value;
	}
}
